package com.mls.fivedistrict.pojo;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 新闻
 * </p>
 *
 * @author Five Team
 * @since 2018-05-16
 */
@Data
@Accessors(chain = true)
@TableName(value = "t_news")
public class News extends Model<News> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 新闻标题
     */
    @NotBlank(message = "新闻标题不能为空")
    private String title;
    /**
     * 新闻摘要
     */
    private String digest;
    /**
     * 新闻内容
     */
    @NotBlank(message = "新闻内容不能为空")
    private String newsContent;
    /**
     * 阅读次数
     */
    private Integer readCount;
    /**
     * 点赞次数
     */
    private Integer likeCount;
    /**
     * 分享次数
     */
    private Integer shareTimes;
    /**
     * 评论总数
     */
    private Integer commentTimes;
    private Integer orders;
    /**
     * 作者
     */
    private String auther;
    /**
     * 编辑人
     */
    private String editor;
    /**
     * 置顶：top为1代表置顶
     */
    private Boolean top;
    private Date createDate;
    private Date updateDate;
    private String createBy;
    /**
     * 新闻标签关系列表
     */
    private transient List<NewsNewsTag> newsNewsTagList;
    @TableLogic
    private Boolean isDelete;
    private Boolean isEnable;
    /**
     * 主图地址
     */
    private String mainIcon;
    /**
     * 是否能评论
     */
    private boolean isCanComment;
    private transient boolean isLike;
    /**
     * 新闻分类
     */
    @NotNull(message = "新闻分类不能为空")
    private Long classifyId;
    /**
     * 奖励DWQ数量
     */
    private BigDecimal rewardDwqNumber;
    /**
     * 点赞奖励dwq数量
     */
    private BigDecimal likeDwqNumber;
    /**
     * 分享奖励的dwq数量
     */
    private BigDecimal shareDwqNumber;

    private transient List<NewsTag> newsTagList;

    public Boolean getDelete() {
        return isDelete;
    }

    public void setDelete(Boolean delete) {
        isDelete = delete;
    }

    public Boolean getEnable() {
        return isEnable;
    }

    public void setEnable(Boolean enable) {
        isEnable = enable;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
